package com.example.back.impl;

import com.example.back.mapper.ProductMapper;
import com.example.back.model.Product;
import com.example.back.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Resource
    private ProductMapper productMapper;

    @Override
    public List<Product> findAllProduct() {
        return productMapper.findAllProduct();
    }

    @Override
    public List<Product> findProductByType(String type) {
        return productMapper.findProductByType(type);
    }

    @Override
    public List<Product> selectGName(String name) {
        return productMapper.selectGName(name);
    }

    @Override
    public Boolean insertProduct(String name, double price, String unit, String type) {
        return productMapper.insertProduct(name, price, unit, type);
    }

    @Override
    public Boolean updateProduct(int id, double price) {
        return productMapper.updateProduct(id, price);
    }

    @Override
    public Boolean deleteProduct(int id) {
        return productMapper.deleteProduct(id);
    }

    @Override
    public String findPhotoByID(int id) {
        return productMapper.findPhotoByID(id);
    }
}
